package round84;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * User: Samuel
 * Date: 08-29-11
 * Time: 10:07 AM
 */
public class A {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        long num = Long.parseLong(in.readLine());
        int c = 0;
        while (num > 0) {
            if (num % 10 == 4 || num % 10 == 7) {
                c++;
            }
            num /= 10;
        }
        boolean isLucky = true;
        if(c == 0) isLucky = false;
        while (c > 0) {
            if (!(c % 10 == 4 || c % 10 == 7)) {
                isLucky = false;
                break;
            }
            c/=10;
        }
        if (isLucky) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}
